from selenium.webdriver.common.by import By
from utils.page_base import PageBase

class PageConcat(PageBase):
    #init函数
    def __init__(self,driver):
        PageBase.__init__(self,driver)

    #元素特征
    loc_addConcat=By.ID,"com.android.contacts:id/floating_action_button"
    loc_name=By.XPATH,"text,姓名,1"
    loc_phone=By.XPATH,["text,电话,1","class,android.widget.E"]
    loc_company=By.XPATH,"text,公司,1"
    loc_website=By.XPATH,"text,网站,1"
    loc_fanhuijiantou=By.CLASS_NAME,"android.widget.ImageButton"
    loc_assert_001_01=By.ID,"com.android.contacts:id/large_title"

    #业务函数实现
    # 函数功能：点击元素“添加联系人”
    def click_addConcat(self):
        self.click(loc=PageConcat.loc_addConcat)

    # 函数功能：输入姓名
    def input_name(self,name):
        self.input_text(loc=PageConcat.loc_name,text=name)

    #函数功能：输入手机号
    def input_phone(self,phone):
        self.input_text(loc=PageConcat.loc_phone, text=phone)

    # 步骤4：输入公司
    def input_company(self,company):
        self.input_text_scroll(loc=PageConcat.loc_company, data=company)

    # 步骤5：输入网站
    def input_website(self,website):
        self.input_text_scroll(loc=PageConcat.loc_website,data=website)

    # 步骤6：点击“返回箭头”
    def click_fanhuijiantou(self):
        self.click(loc=PageConcat.loc_fanhuijiantou)


    #断言辅助函数实现
    def assert_001(self,yuqi):
        return self.getEleText(loc=PageConcat.loc_assert_001_01)==yuqi

